package tech.wetech.admin3.sys.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import tech.wetech.admin3.sys.model.AooAnotherSomeone;
import tech.wetech.admin3.sys.model.AooVirtualMan;

import java.util.List;
import java.util.UUID;

public interface AooAnotherSomeoneRepository extends JpaRepository<AooAnotherSomeone, Integer> {
  List<AooAnotherSomeone> findByEmail(String email);
//  List<AooAnotherSomeone> findByStatusAndAgreeOrNot(Integer status, String agreeOrNot);

  List<AooAnotherSomeone> findByIdNoAndDigitalName(String idNo, String digitalName);  // 查询虚拟人名字+对应自然人姓名

  List<AooAnotherSomeone> findByDigitalNameContaining(String digitalName);

  List<AooAnotherSomeone> findByEmailAndDigitalName(String email, String digitalName);


  @Query("SELECT e FROM AooAnotherSomeone e WHERE e.agreeOrNot = :agreeOrNot")
  List<AooAnotherSomeone> findByAgreeOrNot(@Param("agreeOrNot") Integer agreeOrNot);

  @Query("SELECT e FROM AooAnotherSomeone e WHERE e.agreeOrNot = :agreeOrNot AND e.status = :status")
  List<AooAnotherSomeone> findByAgreeOrNotAndStatus(@Param("agreeOrNot") Integer agreeOrNot, @Param("status") Integer status);

  AooAnotherSomeone findByOutTradeNo(String outTradeNo);
  AooAnotherSomeone findByUuid(UUID uuid);

  @Query("SELECT e FROM AooAnotherSomeone e WHERE e.paid = :paid AND e.agreeOrNot = :agreeOrNot")
  List<AooAnotherSomeone> findByPaidAndAgreeOrNot(@Param("paid") boolean paid, @Param("agreeOrNot") Integer agreeOrNot);

  List<AooAnotherSomeone> findByImageHashesContaining(String hash);

  List<AooAnotherSomeone> findByModelFileHashesContaining(String hash);
}
